import React ,{useEffect, useState} from 'react';
import {Select, Button, Table } from 'antd'

import TimeList from "../../components/chen/TimeList";
import '../../styles/chen/systemhandle.scss'
import * as service from  '../../api/chen/index'
interface Props{

}
function SystemHandle(props:Props) {
  const [data, setData] = useState([])
  useEffect(() => {
    service.handle_list().then(res => {
      setData(res.data)
    })
  },[])
      // const data = [
      //   {
      //    id: '1',
      //       newstitle: '服务包停用通知',
      //       newscontent:"编号0009090服务包因服务项目更新将于10/09-10/11号暂停使用，预计10/12日重新恢复使用，敬请期待",
      //       person: "李明明",
      //       condition: '待发布',
      //     endingtime: 'New York No. 1 Lake Park',
        
      //   description:''
      //   },
      //   {
      //    id: '2',
      //       newstitle: '服务包停用通知',
      //       newscontent:"编号0009090服务包因服务项目更新将于10/09-10/11号暂停使用，预计10/12日重新恢复使用，敬请期待",
      //       person: "李明明",
      //       condition: '待发布',
      //     endingtime: 'New York No. 1 Lake Park',
        
      //   description:''
      //   },
      //   {
      //    id: '3',
      //       newstitle: '服务包停用通知',
      //       newscontent:"编号0009090服务包因服务项目更新将于10/09-10/11号暂停使用，预计10/12日重新恢复使用，敬请期待",
      //       person: "李明明",
      //       condition: '待发布',
      //       endingtime: 'New York No. 1 Lake Park',
      //       description:''
      //   },
        
      // ];
       const columns= [
    
        {
          title: '操作人',
          dataIndex: 'person',
        },
        {
          title: '操作时间',
          dataIndex: 'endingtime',
        },
        {
          title: 'IP',
          dataIndex: 'IP',
        },
        {
          title: '操作模块',
          dataIndex: 'operation',
        },
        {
          title: '操作详情',
          dataIndex: 'details',
        },
     
    ];
    const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
    
    
    const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
        console.log('selectedRowKeys changed: ', newSelectedRowKeys);
        setSelectedRowKeys(newSelectedRowKeys);
      };
    
      const rowSelection = {
        selectedRowKeys,
        onChange: onSelectChange,
      };
      const handleChange = (value: string) => {
  console.log(`selected ${value}`);
};
    return (
        <div className='system-handle'>
           <h4>操作日志</h4> 
        <div className='handle-title'>
          <div>
                操作人  <Select
      defaultValue="请选择"
      style={{ width: 120 }}
      onChange={handleChange}
      options={[
        { value: '李明明', label: '李明明' },
        { value: '王汉文', label: '王汉文' },
        { value: '李民进', label: '李民进' },
        
      ]}
            />
            </div>
                <TimeList></TimeList>
                
                    <Button>导出</Button>
               
                </div>
            <Table rowSelection={rowSelection} columns={columns} dataSource={data} />
        </div>
    );
}

export default SystemHandle;